﻿using System;
using NUnit.Framework;
using Autofac;

namespace Common.UnitTests
{
    [TestFixture]
    public abstract class UnitTestBase
    {
        protected IContainer UnitTestContainer { get; private set; }
        protected ContainerBuilder ContainerBuilder { get; private set; }

        protected UnitTestBase()
        {
            ContainerBuilder = new ContainerBuilder();
            UnitTestContainer = ContainerBuilder.Build();
        }

        protected void AddRegistration(Action<ContainerBuilder> addBuilds)
        {
            addBuilds(ContainerBuilder);
            UnitTestContainer = ContainerBuilder.Build();
        }
    }
}
